// pages/details/details.js
var app = getApp()
var admin_id = app.globalData.admin_id;
var goods_id = 0;
var WxParse = require('../../wxParse/wxParse.js');
var share = app.globalData.share;
Page({

	data: {

	},

	onLoad: function (options) {
		var that = this;
		wx.request({
			url: app.globalData.host + 'index.php/api/goods/goodsInfo?admin_id=' + admin_id,
			success: function (e) {
				goods_id = options.id;
				that.setData({
					all: e.data.result,
					items: e.data.result.filter(that.filterHeaderGoodsid)[0]
				})
				var article = e.data.result.filter(that.filterHeaderGoodsid)[0].goods_content;
				WxParse.wxParse('article', 'html', article, that, 8);
			}
		})
	},
	
	onShareAppMessage: function () {
		return {
			title: share,
			path: 'pages/index/index'
		}
	},
	filterHeaderGoodsid: function (e) {
		return (e.goods_id == goods_id)
	}
})